<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2024/4/24
  Time: 20:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title><%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2024/4/12
  Time: 14:41
  To change this template use File | Settings | File Templates.
--%>
        <%@ page contentType="text/html;charset=UTF-8" language="java" %>
        <html>
        <head>
        <title>柱状图</title>
</head>
<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main1" style="width: 600px;height: 400px;"></div>
<div id="main2" style="width: 600px;height: 400px;"></div>
<script src="/static/echarts.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    $.post(
        '/blog?method=selectBlogCount',
        function(jsonObj) {
            //[{name: 'Java1807', value: 3},{name: 'Java1812', value: 1}]
            console.log(jsonObj);


            //-----------饼状图----------------
            var option = {
                title: {
                    text: 'Referer of a Website',
                    subtext: 'Fake Data',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left'
                },
                series: [
                    {
                        name: 'Access From',
                        type: 'pie',
                        radius: '50%',
                        data: jsonObj.data,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };

            myChart.setOption(option);
        },
        'json'
    );

</script>
</body>
</html>
</title>
</head>
<body>

</body>
</html>
